package com.mavenq.fly.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import com.mavenq.fly.interceptor.MybaitisIntercepor;
import com.mavenq.fly.interceptor.SqlInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MybatisPlusConfig {

    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        //如果配置多个插件,切记分页最后添加，
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
        return interceptor;
    }

//    @Bean
//    public SqlInterceptor sqlInterceptor() {
//        return new SqlInterceptor();
//    }

    @Bean
    public MybaitisIntercepor mybaitisIntercepor(){
        return new MybaitisIntercepor();
    }
}
